package com.victualler.core.common.dto;

import java.io.Serializable;
import java.util.List;

/**
 * @Aouthor Guoshichang
 * @Date 11:54 on 2018/6/27.
 * @Function 分页对象
 */
public class PageDto<T> implements Serializable{
    private List<T> dataList;
    private int pageNo;
    private int limit;
    private long dataCount;
    private int pageLength;

    public PageDto() {
    }

    public PageDto(List<T> dataList, int pageNo, int limit, long dataCount) {
        this.dataList = dataList;
        this.pageNo = pageNo;
        this.limit = limit;
        this.dataCount = dataCount;
        this.pageLength =(int)dataCount/limit;
        if(dataCount%limit>0){
            this.pageLength+=1;
        }
    }

    public List<T> getDataList() {
        return dataList;
    }

    public void setDataList(List<T> dataList) {
        this.dataList = dataList;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public long getDataCount() {
        return dataCount;
    }

    public void setDataCount(long dataCount) {
        this.dataCount = dataCount;
    }

    public int getPageLength() {
        return pageLength;
    }

    public void setPageLength(int pageLength) {
        this.pageLength = pageLength;
    }
}
